<template>
	<view>
		<view class="head">
			<view style="font-weight: bold; font-size: 40rpx;">员工邀约列表</view>
		</view>
		
		<!-- 员工邀约列表 -->
		<staffInvList :invite_list_data="admin_invite_list_data" :length="admin_invite_list_data.length" :staff_name="staff_name " :status="status" />
		
		<view class="top" :style="{'display':(flag===true? 'block':'none')}">
			<uni-icons class="topc" type="arrowthinup" size="30" @click="top"></uni-icons>
		</view>
	</view>
</template>

<script>
	import uniIcons from '../../components/common/uni-icons/uni-icons.vue'
	export default {
		components: {
			uniIcons
		},
		data() {
			return {
				admin_invite_list_data: [],
				page: 1,
				status: 'nomore',
				flag: false,
				activity_id: 0,
			}
		},
		onLoad(e) {
			this.staff_id = e.staff_id
			this.staff_name = e.staff_name
			this.activity_id = e.activity_id
			this.$comm.appLogin(user_info=>{
				this.admin_invite_list()
			})
		},
		onPullDownRefresh() {
			this.loaddata()
		},
		onReachBottom() {
			// this.admin_invite_list()
		},
		methods: {
			//获取员工邀约列表
			admin_invite_list(){
				// if (this.status == 'nomore') {
				// 	return
				// }
				this.$comm.request({
					url: 'api/admin_invite_list',
					method: 'GET',
					data: {
						activity_id: this.activity_id,
						staff_id: this.staff_id,
						// page: this.page++,
					},
					success: res => {
						var res = res.data
						console.log(res,'admin_invite_list')
						this.admin_invite_list_data = res.result
						let list = res.result
						if (list.length < 10) {
							this.status = 'nomore'
						}
					}
				})
			},
			
			loaddata() {
				this.page = 1
				this.status = 'more'
				this.admin_invite_list_data = []
				this.admin_invite_list()
				setTimeout(function() {
					uni.stopPullDownRefresh();
				}, 1000);
			},
			
			//回到顶部
			top() {
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 300
				});
			},
			onPageScroll(e) { //根据距离顶部距离是否显示回到顶部按钮
				if (e.scrollTop > 600) { //当距离大于600时显示回到顶部按钮
					this.flag = true
				} else { //当距离小于600时显示回到顶部按钮
					this.flag = false
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/common/main.css';
	@import  '@/common/zcm-main.css';
	
	page{
		font-size: 30rpx;
	}
	
	.head {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-top: 30rpx;
	
		.head-text {
			// position: fixed;
			color: #ffffff;
			line-height: 2.5;
			background-color: #475dfc;
			width: 400rpx;
			text-align: center;
			border-radius: 50rpx;
			margin: 0rpx 15rpx 15rpx 15rpx;
		}
	}
	
	.top {
		position: relative;
		display: none;
		/* 先将元素隐藏 */
	}
	
	.topc {
		position: fixed;
		right: 0;
		// background: #F0F0F0;
		bottom: 30rpx;
		right: 30rpx;
		background-color: #FFF;
		border: solid 2rpx #475dfc;
		border-radius: 100rpx;
		height: 80rpx;
		width: 80rpx;
		line-height: 80rpx;
	}
</style>
